import sqlite3
import json
from datetime import datetime as dt


class WDB():
    def __init__(self, NameFile: str):
        self.conn = sqlite3.connect(NameFile, check_same_thread=False)
        self.cur = self.conn.cursor()

    def get_info_order(self, id_order:str):
        sqlText = "SELECT uuid_order, size_pay, date_order, status_order " +\
            f"FROM orders WHERE uuid_order = '{id_order}';"
        print()
        print(sqlText)
        print()
        self.cur.execute(sqlText)
        list_idea = self.cur.fetchall()
        print(list_idea)
        return list_idea

    def InsertOrder(self, order: json):
        sqlText = "INSERT INTO orders (uuid_order, size_pay, date_order, " +\
            "status_order)" +\
            f"""VALUES('{order["uuid_order"]}', """ +\
            f"""'{order["size_pay"]}', '{order["date_order"]}', '{order["status_order"]}');"""

        print(sqlText)
        self.cur.execute(sqlText)
        self.conn.commit()

    def InsertContent(self, TextIdea: json):
        sqlText = "INSERT INTO Ideas(idea, tagidea, MyComm, idSource, summSources, datewrite) " +\
            f"""VALUES("{TextIdea['TextIdea']}", "{TextIdea['summTegs']}", "", '0', "{TextIdea['summSources']}", DATE());"""

        print(sqlText)
        self.cur.execute(sqlText)
        self.conn.commit()


def prog1():
    l1 = [10]
    l2 = [10]
    print(l1 is l2)


def prog2():
    s1 = "abc"
    s2 = "abcdef"
    print(s1.__contains__(s2))


if __name__ == '__main__':
    name = ''
    prog1()
    prog2()
